package bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import metier.Film;
import metier.Personne;
import DAO.*;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean(name="beanRecherche")
@SessionScoped
public class BeanRecherche implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String motCle;
	List<Personne> listePers= new ArrayList<Personne>();
	List<Film> listeFilm = new ArrayList<Film>();
		
	public String getMotCle() {
		return this.motCle;
	}
	
	public void setMotCle (String motCle) {
		this.motCle= motCle;
	}
	
	
	public List<Personne> getListePers() {
		return listePers;
	}

	public List<Film> getListeFilm() {
		return listeFilm;
	}

	public String lanceRecherche(){
		this.listeFilm=DAOFilmJPA.getInstance().loadAllWithName(motCle);
		this.listePers= DAOPersonneJPA.getInstance().loadAllWithName(motCle);
		return "Resultat";
	}
	
	
}
